<include file="Index/header" />

<div class="container">
	<nav class="navbar navbar-default" role="navigation">
		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
			<ul class="nav navbar-nav">
				<li>
					<a href="?m=admin&c=goods&a=index" class="glyphicon glyphicon-arrow-right">返 回</a>
				</li>
			</ul>
			<form class="navbar-form navbar-right" action="?m=admin&c=goods&a=query" method="post" role="search">
				<div class="form-group">
					<input type="text" class="form-control" placeholder="商品名称" id="gn" name="gn" />
				</div> <button type="submit" class="btn btn-default">搜索</button>
			</form>
		</div>
	</nav>
	<form action="?m=admin&c=goods&a=update" method="post" onsubmit="return check()"
		style="margin: 0 auto; width: 30%;">
		<h3>商品修改</h3>
		<div class="form-group">
			<label for="exampleInputEmail1">商品图片：</label>
			<img class="img-rounded" src="__PUBLIC__/images/goods/{$goodsInfo.pic_url}" width="300px" height="300px"
				alt="">
			<input type="hidden" class="form-control" name="pic_url" value="{$goodsInfo.pic_url}" />
		</div>
		<div class="form-group">
			<label for="goods_brand">商品品牌</label>
			<input type="text" class="form-control" name="goods_brand" value="{$goodsInfo.goods_brand}" />
		</div>
		<div class="form-group">
			<label for="goods_name">商品名称</label>
			<input type="text" class="form-control" name="goods_name" value="{$goodsInfo.goods_name}" />
		</div>
		<div class="form-group">
			<label for="goods_price">商品价格：￥</label>
			<input type="number" class="form-control" name="goods_price" min="0.00" max="999.00" step="0.01"
				value="{$goodsInfo.goods_price}" />
		</div>
		<div class="form-group">
			<label for="goods_descript">商品描述</label>
			<input type="text" class="form-control" name="goods_descript" value="{$goodsInfo.goods_descript}" />
		</div>
		<div class="form-group">
			<label for="goods_descript">上下架状态</label>
			<select class="form-control" name="goods_status">
				<option value="0">已下架</option>
				<option value="1" selected=<eq name="goodsInfo.goods_status">已上架</option>
			</select>
		</div>
		<div class="form-group">
			<label for="goods_address">地址</label>
			<input type="text" class="form-control" name="goods_address" value="{$goodsInfo.goods_address}" />
		</div>
		<div class="form-group">
			<label for="goods_descript">库存</label>
			<input type="number" class="form-control" name="goods_qty" value="{$goodsInfo.goods_qty}" min="0" max="999"
				οnkeypress='return( /[\d]/.test(String.fromCharCode(event.keyCode) ) )' />
		</div>
		<input type="hidden" name="goods_id" value="{$goodsInfo.goods_id}">
		<button type="submit" class="btn btn-default btn-block">提交</button>
		<button type="reset" class="btn btn-default btn-block">重置</button>
	</form>

	<br />
	<br />
</div>


<script type="text/javascript">
	function query() {
		var name = document.getElementById('name').value;
		if (name == '') {
			alert("查询商品名称不能为空!");
			return false;
		}
		return true;
	}

	function centain() {
		if (window.confirm("确认修改商品信息吗")) {
			return true;
		}
		return false;
	}

	function check() {
		if (document.getElementById('g_b').value == null) {
			alert("品牌不能为空!");
			return false;
		}

		if (document.getElementById('g_n').value == '') {
			alert("名称不能为空!");
			return false;
		}

		if (document.getElementById('g_p').value == '') {
			alert("价格不能为空!");
			return false;
		}

		if (document.getElementById('g_d').value == '') {
			alert("描述不能为空!");
			return false;
		}

		if (document.getElementById('g_ad').value == '') {
			alert("地址不能为空!");
			return false;
		}

		if (document.getElementById('g_p').value == '') {
			alert("图片信息不能为空!");
			return false;
		}
		return true;
	}

</script>
<include file="Index/footer" />